﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace AppServices
{
	[ServiceContract]
	public interface IWCFService
	{
		[OperationContract]
		string GetData(int value);

		[OperationContract]
		CompositeType GetDataUsingDataContract(CompositeType composite);

		[OperationContract]
		void AddProduct(ProductsClass product);

		[OperationContract]
		void DeleteProduct(ProductsClass product);

		[OperationContract]
		void EditProduct(ProductsClass product);

		[OperationContract]
		ProductsClass GetProduct(string productName);

		[OperationContract]
		ProductsClass[] GetProducts();

		[OperationContract]
		bool GetIfDuplicateProductNamesExists(string productName);

		[OperationContract]
		bool GetIfProductOrdersExists(string productName);

		[OperationContract]
		void AddCustomer(CustomersClass customer);

		[OperationContract]
		void DeleteCustomer(CustomersClass customer);

		[OperationContract]
		CustomersClass GetCustomer(string companyName);

		[OperationContract]
		CustomersClass[] GetCustomers();

		[OperationContract]
		bool GetIfCustomerNamesExists(string customerName);

		[OperationContract]
		void AddOrder(OrdersClass order);

		[OperationContract]
		void DeleteOrder(OrdersClass order);

		[OperationContract(Name="GetOrderByInstance")]
		OrdersClass GetOrder(OrdersClass order);

		[OperationContract(Name="GetOrderByID")]
		OrdersClass GetOrder(int orderID);

		[OperationContract]
		OrdersClass[] GetOrders();

		[OperationContract]
		void AddOrderDetails(OrderDetailsClass orderDetails);

		[OperationContract]
		void DeleteOrderDetails(OrderDetailsClass orderDetails);

		[OperationContract()]
		OrderDetailsClass GetOrderDetails(int orderID);

		[OperationContract]
		void AddProductsOnOrderFullInfo(ProductsOnOrderFullInfoClass orderDetails);

		[OperationContract]
		void DeleteProductsOnOrderFullInfo(ProductsOnOrderFullInfoClass orderDetails);

		[OperationContract]
		ProductsOnOrderFullInfoClass[] GetProductsOnOrderFullInfo();
	}

	// Use a data contract as illustrated in the sample below to add composite types to service operations.
	[DataContract]
	public class CompositeType
	{
		bool boolValue = true;
		string stringValue = "Hello ";

		[DataMember]
		public bool BoolValue
		{
			get { return boolValue; }
			set { boolValue = value; }
		}

		[DataMember]
		public string StringValue
		{
			get { return stringValue; }
			set { stringValue = value; }
		}
	}
}
